<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>点击获取xml</button>
    <script>
        let btn = document.querySelector("button");
        btn.onclick = function (){
            let xhr = new XMLHttpRequest();
            xhr.open("get","xml.php",true);
            xhr.onload = function (){
                let name = xhr.responseXML.querySelector("nodejs name").innerHTML;
                            // xhr.responseXML.querySelector("nodejs name").innerHTML;
                let str = xhr.responseXML.querySelector("nodejs price").innerHTML;
                let arr = str.match(/^\d+$/g);
                console.log(arr);
            }
            xhr.send();
        }
    </script>
</body>
</html>